package com.shop.common.exception;

import com.shop.common.enums.ExceptionEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
public class OperationException extends RuntimeException {
    public Integer code;
    public Object data;
    public OperationException(Integer code,String message) {
        super(message);
        this.code = code;
    }
    public OperationException(Integer code,String message,Object data) {
        super(message);
        this.code = code;
        this.data = data;
    }
    public OperationException(ExceptionEnum exceptionEnum) {
        super(exceptionEnum.getMsg());
        this.code = exceptionEnum.getCode();
    }

    public OperationException(ExceptionEnum exceptionEnum,Object data) {
        super(exceptionEnum.getMsg());
        this.code = exceptionEnum.getCode();
        this.data = data;
    }
    public OperationException(ExceptionEnum exceptionEnum,String message) {
        super(message);
        this.code = exceptionEnum.getCode();
    }
}
